//
//  UITableViewCell+QDTextListModelUpdater.m
//  QDMetroClient
//
//  Created by YueWen on 2019/2/18.
//  Copyright © 2019 YueWen. All rights reserved.
//

#import "UITableViewCell+QDTextListModelUpdater.h"
#import "QDTextListModel.h"
#import "QDTextTableViewCell+QDTextListModel.h"
#import <UIImageView+WebCache.h>

@implementation UITableViewCell (QDTextListModelUpdater)

- (void)textUpdateByData:(nullable id)data
             atIndexPath:(NSIndexPath *)indexPath
                delegate:(id)delegate
         associateObject:(nullable id)associatedObject {
    
}

- (CGFloat)textUpdaterHeightByData:(id)data atIndexPath:(NSIndexPath *)indexPath {
    return CGFLOAT_MIN;
}

@end


@implementation QDTextTableViewCell (QDTextListModelUpdater)

- (void)textUpdateByData:(nullable QDTextListModel *)data
             atIndexPath:(NSIndexPath *)indexPath
                delegate:(id)delegate
         associateObject:(nullable id)associatedObject {
    
    if (![data isKindOfClass:QDTextListModel.class]) { return; }
    
    self.indexPath = indexPath;
    self.delegate = delegate;
    self.textModel = data;
    
    //进行赋值
    self.titleLabel.text = data.title;
    self.subtitleLabel.text = [NSString stringWithFormat:@"%@ 阅读  %@",data.readString,data.date];
    [self.imageView sd_setImageWithURL:data.imageUrl.ritl_url];
    
}

- (CGFloat)textUpdaterHeightByData:(id)data atIndexPath:(NSIndexPath *)indexPath {
    return 98;
}

@end




